# $Id$
# Maintainer: Andreas Radke <andyrtr at archlinux.org>
# Contributor: Thomas Baechler <thomas.baechler@rwth-aachen.de>

pkgname=cups-pdf
pkgver=3.0.1
pkgrel=1
pkgdesc="PDF printer for cups"
arch=(i686 x86_64)
depends=('cups' 'ghostscript')
install=cups-pdf.install
# broken cert setup for https
url="http://www.cups-pdf.de/welcome.shtml"
license=('GPL2')
source=(http://www.cups-pdf.de/src/cups-pdf_$pkgver.tar.gz)
backup=(etc/cups/cups-pdf.conf)
# http://www.cups-pdf.de/src/cups-pdf_3.0.1.tar.gz.md5 - no other checksums
md5sums=('5071bf192b9c6eb5ada4337b6917b939')

build() {
  cd $srcdir/$pkgname-$pkgver/src
  [ -z "$CC" ] && CC=gcc
#  $CC $CFLAGS -Wall -o cups-pdf cups-pdf.c
  $CC $CFLAGS -s cups-pdf.c -o cups-pdf -lcups  
}

package() {
  cd $srcdir/$pkgname-$pkgver/src
  install -D -m700 cups-pdf $pkgdir/usr/lib/cups/backend/cups-pdf

  # Install Postscript Color printer
  cd ../extra
  install -D -m644 CUPS-PDF_noopt.ppd $pkgdir/usr/share/cups/model/CUPS-PDF_noopt.ppd
  install -D -m644 CUPS-PDF_opt.ppd $pkgdir/usr/share/cups/model/CUPS-PDF_opt.ppd

  # Install config file
  install -D -m644 cups-pdf.conf $pkgdir/etc/cups/cups-pdf.conf

  # Install docs
  install -D -m 644 ../README "$pkgdir"/usr/share/doc/$pkgname/README
  
  # use lp group from cups pkg FS#36769
  chgrp -R lp ${pkgdir}/etc/cups
}
